package metier;
import java.sql.Date;
import java.util.HashMap;
public class Catalogue 
{
	private int annee;
	private Date dateDebut;
	private Date dateFin;
	private HashMap <Jouet, Integer> lesJouetsProposes;
	
	public Catalogue(int annee, Date dateDebut, Date dateFin) {
		super();
		this.annee = annee;
		this.dateDebut = dateDebut;
		this.dateFin = dateFin;
		this.lesJouetsProposes = new HashMap <Jouet, Integer>();
	}
	public int getAnnee() {
		return annee;
	}
	public Date getDateDebut() {
		return dateDebut;
	}
	public Date getDateFin() {
		return dateFin;
	}
	public int quantiteProposee()
	{
		int qteTot;
		qteTot = 0;
		
		for (Integer qte : this.lesJouetsProposes.values())
			qteTot += qte;
		return qteTot;
	}
	public HashMap <Categorie, Integer> statsCateg()
	{
		HashMap <Categorie, Integer> res;
		int qte;
		res = new HashMap <Categorie, Integer>();
		for (Jouet j : this.lesJouetsProposes.keySet())
		{
			qte = this.lesJouetsProposes.get(j);
			if (res.containsKey(j.getLaCateg()))
				qte = qte + res.get(j.getLaCateg());
			res.put(j.getLaCateg(), qte);
		}
		return res;
	}
	public void ajouterJouet(Jouet j, Integer qte)
	{
		this.lesJouetsProposes.put(j, qte);
	}
}